package com.bdqn.ch02.repository;

import com.bdqn.ch02.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

//JpaRepository 基本的crud
//JpaSpecificationExecutor  复杂查询，解决动态sql

public interface UserRepository extends JpaRepository<User, Long>,JpaSpecificationExecutor<User> {

    public List<User> findByUsrNameOrUsrPassword(String aaa, String bbb);

   // @Query("select u from User u where u.usrRoleId=?1")
   // public List<User> findByRoleId(Long roleId);

    @Query("select u from User u")
    public Page<User> findUserPage(Pageable pageable);

}
